package com.xinghuo.building.ui.base

import androidx.annotation.VisibleForTesting
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.product.xlogger.ILogger
import com.product.xlogger.XLogger
import com.xinghuo.building.usecase.errors.ErrorManager
import com.xinghuo.building.utils.SingleEvent
import javax.inject.Inject


/**
 * Created by chendaning
 */


abstract class BaseViewModel : ViewModel() {

    /**Inject Singleton ErrorManager
     * Use this errorManager to get the Errors
     */
    @Inject
    lateinit var errorManager: ErrorManager

    protected lateinit var logger: ILogger
    init {
        logger = XLogger.getInstance()
    }

    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
    protected val showToastPrivate = MutableLiveData<SingleEvent<Any>>()
    val showToast: LiveData<SingleEvent<Any>> get() = showToastPrivate
}
